﻿@{
    Layout = null;
}
@model System.Collections.IEnumerable
           
<!DOCTYPE html>

<html>
@Html.Partial("LoadPanelPartial")
<head>
  @if (false)
    {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    
         <script>
             if (top.boardtop) {
                 if (@ViewData["FClass"].ToString() == "1") {
                     top.boardtop.head_txt.innerText = "请假补录登记管理";
                 }
                 else {
                     top.boardtop.head_txt.innerText = "外出补录登记管理";
                 }
             }
    </script>

    @Html.DevExpress().GetStyleSheets(

                new StyleSheet { ExtensionType = ExtensionType.GridView, Theme = DevExpressHelper.Theme }

)
    @Html.DevExpress().GetScripts(
                    new Script { ExtensionType = ExtensionType.ListBox }
    )

    <script type="text/javascript">
        $(function () {
            $("#toolMenu").smartFloat();
        });

        function OnBeginCallback(s, e) {
            e.customArgs["command"] = e.command;
            e.customArgs["pageIndex"] = s.pageIndex;
            e.customArgs["pageCount"] = s.pageCount;
            e.customArgs["pageRowSize"] = s.pageRowSize;
            e.customArgs["pageRowCount"] = s.pageRowCount;
            e.customArgs["FClass"] = $("#hdFClass").val();
        }


        function MenuTop_emClick(source, e) {
            switch (e.item.name) {
                case "btnAdd":
                    {
                        //                        $("#popContent").attr("src", rootPath + "/Admin/WorkTime/EditWorkTime");
                        //                        EditWorkModalMode.Show();
                        window.location.href = rootPath + "/Admin/LeaveAddition/LeaveEdit?FClass=" + $("#hdFClass").val();
                        break;
                    }
            }
        }


        function LeaveOut(FLeaveID) {
            if (confirm("是否确定签退记录?")) {
                $.ajax({
                    type: 'POST',
                    url: rootPath + '/Admin/Leave/LeaveOut',
                    data: { FLeaveID: FLeaveID },
                    success: function (result) {
                        if (result == "ok") {
                            alert("签退成功!");
                            gvEditing.Refresh();
                        } else if (result == "error") {
                            alert("签退失败!");
                        }
                        else if (result == "date") {
                            alert("时间未到无法签退！");
                        }
                        else {
                            alert("删除参数错误!");
                        }
                    }
                });
            }
        }

        //编辑
        function LeaveEdit(FLeaveID) {
            //            $("#popContent").attr("src", rootPath + "/Admin/WorkTime/EditWorkTime?FWorkTimeID=" + FWorkTimeID);
            //            EditWorkModalMode.Show();

            window.location.href = rootPath + "/Admin/LeaveAddition/LeaveEdit?FClass=" + $("#hdFClass").val() + "&FLeaveID=" + FLeaveID;
        }





        //编码保存确定
        //        function EditWorkOK() {
        //            alert("保存成功");
        //            EditWorkModalMode.Hide();
        //            gvEditing.Refresh();
        //        }

        //        //编码保存取消
        //        function EditWorkCancel() {
        //            EditWorkModalMode.Hide();
        //        }

        //删除
        function LeaveDel(FLeaveID) {
            if (confirm("是否确定删除?")) {
                $.ajax({
                    type: 'POST',
                    url: rootPath + '/Admin/LeaveAddition/DelLeave',
                    data: { FLeaveID: FLeaveID },
                    success: function (result) {
                        if (result == "ok") {
                            alert("删除成功!");
                            gvEditing.Refresh();
                        } else if (result == "error") {
                            alert("删除失败!");
                        } else {
                            alert("删除参数错误!");
                        }
                    }
                });
            }
        }
    </script>

</head>
<body>
 <div class="floatToolMenu" id="toolMenu">
        @Html.DevExpress().Menu(settings =>
       {
           settings.Name = "toolBarMenu";
           settings.ItemAutoWidth = false;
           settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
           settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
           settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);
           settings.Items.Add(item =>
           {
               item.Name = "btnAdd";
               if (ViewData["FClass"].ToString() == "1")
               {
                   item.Text = "请假补录登记";
               }
               else
               {
                   item.Text = "外出补录登记";
               }
               item.ClientEnabled = true;
               item.Image.Url = Url.Content("~/Content/ControlImages/edit_add.png");

           });
           settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
           settings.ItemLinkMode = ItemLinkMode.ContentBounds;
       }).GetHtml()
    </div>

    @Html.Partial("LeaveListPartial", Model)

    @Html.Hidden("hdFClass", ViewData["FClass"])
</html>
